﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.SweptVolume.CUiSvSweptVolumeDlg
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.SweptVolume;

public class CUiSvSweptVolumeDlg : TxForm
{
  private Label m_operationLabel;
  private Label m_robotLabel;
  private Label m_maxErrorLabel;
  private Label m_volumeAccLabel;
  private Label m_accuracyValueLabel;
  private Label m_accuracyUnitsLabel;
  private Label m_fastLabel;
  private Label m_accurate_label;
  private TrackBar m_accuracyTrackBar;
  private TxObjEditBoxCtrl m_operation_txObjEditBoxCtrl;
  private TxObjComboBoxCtrl m_fromLocation_txObjComboBoxCtrl;
  private TxObjComboBoxCtrl m_toLocation_txObjComboBoxCtrl1;
  private Label m_FromLabel;
  private Label m_toLabel;
  private Label m_includedObjectsLabel;
  private TextBox m_robotNameTextBox;
  private TreeView m_includedObjectsTreeView;
  private TxProgressBar m_progressBar;
  private Button m_closeButton;
  private Button m_createButton;
  private Container components;
  private CCoSVSweptVolumeCmd m_cmd;
  private bool m_createOrStopMode;

  public CUiSvSweptVolumeDlg(CCoSVSweptVolumeCmd cmd)
  {
    this.InitializeComponent();
    this.m_cmd = cmd;
    this.m_createOrStopMode = false;
    cmd.DialogIsOpen(true);
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    this.m_operationLabel = new Label();
    this.m_robotLabel = new Label();
    this.m_volumeAccLabel = new Label();
    this.m_maxErrorLabel = new Label();
    this.m_accuracyValueLabel = new Label();
    this.m_accuracyUnitsLabel = new Label();
    this.m_fastLabel = new Label();
    this.m_accurate_label = new Label();
    this.m_accuracyTrackBar = new TrackBar();
    this.m_operation_txObjEditBoxCtrl = new TxObjEditBoxCtrl();
    this.m_fromLocation_txObjComboBoxCtrl = new TxObjComboBoxCtrl();
    this.m_toLocation_txObjComboBoxCtrl1 = new TxObjComboBoxCtrl();
    this.m_FromLabel = new Label();
    this.m_toLabel = new Label();
    this.m_includedObjectsLabel = new Label();
    this.m_robotNameTextBox = new TextBox();
    this.m_includedObjectsTreeView = new TreeView();
    this.m_progressBar = new TxProgressBar();
    this.m_closeButton = new Button();
    this.m_createButton = new Button();
    this.m_accuracyTrackBar.BeginInit();
    ((Control) this).SuspendLayout();
    this.m_operationLabel.Location = new Point(8, 16 /*0x10*/);
    this.m_operationLabel.Name = "m_operationLabel";
    this.m_operationLabel.Size = new Size(56, 23);
    this.m_operationLabel.TabIndex = 0;
    this.m_operationLabel.Text = "Operation";
    this.m_robotLabel.Location = new Point(8, 40);
    this.m_robotLabel.Name = "m_robotLabel";
    this.m_robotLabel.Size = new Size(40, 23);
    this.m_robotLabel.TabIndex = 0;
    this.m_robotLabel.Text = "Robot";
    this.m_volumeAccLabel.Location = new Point(8, 64 /*0x40*/);
    this.m_volumeAccLabel.Name = "m_volumeAccLabel";
    this.m_volumeAccLabel.Size = new Size(112 /*0x70*/, 23);
    this.m_volumeAccLabel.TabIndex = 0;
    this.m_volumeAccLabel.Text = "Volume Accuracy:";
    this.m_maxErrorLabel.Location = new Point(152, 64 /*0x40*/);
    this.m_maxErrorLabel.Name = "m_maxErrorLabel";
    this.m_maxErrorLabel.Size = new Size(64 /*0x40*/, 23);
    this.m_maxErrorLabel.TabIndex = 0;
    this.m_maxErrorLabel.Text = "Max Error:";
    this.m_accuracyValueLabel.Location = new Point(224 /*0xE0*/, 64 /*0x40*/);
    this.m_accuracyValueLabel.Name = "m_accuracyValueLabel";
    this.m_accuracyValueLabel.Size = new Size(24, 16 /*0x10*/);
    this.m_accuracyValueLabel.TabIndex = 0;
    this.m_accuracyValueLabel.Text = "30";
    this.m_accuracyUnitsLabel.Location = new Point(256 /*0x0100*/, 64 /*0x40*/);
    this.m_accuracyUnitsLabel.Name = "m_accuracyUnitsLabel";
    this.m_accuracyUnitsLabel.Size = new Size(24, 16 /*0x10*/);
    this.m_accuracyUnitsLabel.TabIndex = 0;
    this.m_accuracyUnitsLabel.Text = "mm";
    this.m_fastLabel.Location = new Point(8, 96 /*0x60*/);
    this.m_fastLabel.Name = "m_fastLabel";
    this.m_fastLabel.Size = new Size(32 /*0x20*/, 23);
    this.m_fastLabel.TabIndex = 0;
    this.m_fastLabel.Text = "Fast";
    this.m_accurate_label.Location = new Point(232, 96 /*0x60*/);
    this.m_accurate_label.Name = "m_accurate_label";
    this.m_accurate_label.Size = new Size(56, 23);
    this.m_accurate_label.TabIndex = 0;
    this.m_accurate_label.Text = "Accurate";
    this.m_accuracyTrackBar.LargeChange = 10;
    this.m_accuracyTrackBar.Location = new Point(32 /*0x20*/, 88);
    this.m_accuracyTrackBar.Maximum = 100;
    this.m_accuracyTrackBar.Minimum = 10;
    this.m_accuracyTrackBar.Name = "m_accuracyTrackBar";
    this.m_accuracyTrackBar.Size = new Size(200, 45);
    this.m_accuracyTrackBar.TabIndex = 5;
    this.m_accuracyTrackBar.TickFrequency = 10;
    this.m_accuracyTrackBar.Value = 30;
    this.m_accuracyTrackBar.ValueChanged += new EventHandler(this.m_accuracyTrackBar_ValueChanged);
    this.m_operation_txObjEditBoxCtrl.ListenToPick = true;
    ((Control) this.m_operation_txObjEditBoxCtrl).Location = new Point(80 /*0x50*/, 16 /*0x10*/);
    ((Control) this.m_operation_txObjEditBoxCtrl).Name = "m_operation_txObjEditBoxCtrl";
    this.m_operation_txObjEditBoxCtrl.Object = (ITxObject) null;
    this.m_operation_txObjEditBoxCtrl.PickLevel = (TxPickLevel) 1;
    this.m_operation_txObjEditBoxCtrl.ReadOnly = false;
    ((Control) this.m_operation_txObjEditBoxCtrl).Size = new Size(200, 24);
    ((Control) this.m_operation_txObjEditBoxCtrl).TabIndex = 6;
    this.m_operation_txObjEditBoxCtrl.ValidatorType = (TxValidatorType) 10;
    this.m_operation_txObjEditBoxCtrl.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_operation_txObjEditBoxCtrl_Picked);
    this.m_operation_txObjEditBoxCtrl.TypeValid += new EventHandler(this.m_operation_txObjEditBoxCtrl_TypeValid);
    this.m_operation_txObjEditBoxCtrl.TypeInvalid += new EventHandler(this.m_operation_txObjEditBoxCtrl_TypeInvalid);
    this.m_fromLocation_txObjComboBoxCtrl.DropDownStyle = ComboBoxStyle.DropDown;
    this.m_fromLocation_txObjComboBoxCtrl.ListenToPick = false;
    ((Control) this.m_fromLocation_txObjComboBoxCtrl).Location = new Point(72, 136);
    ((Control) this.m_fromLocation_txObjComboBoxCtrl).Name = "m_fromLocation_txObjComboBoxCtrl";
    this.m_fromLocation_txObjComboBoxCtrl.Object = (ITxObject) null;
    this.m_fromLocation_txObjComboBoxCtrl.PickLevel = (TxPickLevel) 1;
    ((Control) this.m_fromLocation_txObjComboBoxCtrl).Size = new Size(208 /*0xD0*/, 24);
    ((Control) this.m_fromLocation_txObjComboBoxCtrl).TabIndex = 7;
    this.m_fromLocation_txObjComboBoxCtrl.ValidatorType = (TxValidatorType) 1;
    this.m_toLocation_txObjComboBoxCtrl1.DropDownStyle = ComboBoxStyle.DropDown;
    this.m_toLocation_txObjComboBoxCtrl1.ListenToPick = false;
    ((Control) this.m_toLocation_txObjComboBoxCtrl1).Location = new Point(72, 160 /*0xA0*/);
    ((Control) this.m_toLocation_txObjComboBoxCtrl1).Name = "m_toLocation_txObjComboBoxCtrl1";
    this.m_toLocation_txObjComboBoxCtrl1.Object = (ITxObject) null;
    this.m_toLocation_txObjComboBoxCtrl1.PickLevel = (TxPickLevel) 1;
    ((Control) this.m_toLocation_txObjComboBoxCtrl1).Size = new Size(208 /*0xD0*/, 24);
    ((Control) this.m_toLocation_txObjComboBoxCtrl1).TabIndex = 7;
    this.m_toLocation_txObjComboBoxCtrl1.ValidatorType = (TxValidatorType) 1;
    this.m_FromLabel.Location = new Point(8, 136);
    this.m_FromLabel.Name = "m_FromLabel";
    this.m_FromLabel.Size = new Size(32 /*0x20*/, 23);
    this.m_FromLabel.TabIndex = 0;
    this.m_FromLabel.Text = "From";
    this.m_toLabel.Location = new Point(8, 160 /*0xA0*/);
    this.m_toLabel.Name = "m_toLabel";
    this.m_toLabel.Size = new Size(32 /*0x20*/, 23);
    this.m_toLabel.TabIndex = 0;
    this.m_toLabel.Text = "To";
    this.m_includedObjectsLabel.Location = new Point(8, 192 /*0xC0*/);
    this.m_includedObjectsLabel.Name = "m_includedObjectsLabel";
    this.m_includedObjectsLabel.Size = new Size(96 /*0x60*/, 23);
    this.m_includedObjectsLabel.TabIndex = 0;
    this.m_includedObjectsLabel.Text = "Included Objects";
    this.m_robotNameTextBox.Location = new Point(80 /*0x50*/, 40);
    this.m_robotNameTextBox.Name = "m_robotNameTextBox";
    this.m_robotNameTextBox.ReadOnly = true;
    this.m_robotNameTextBox.Size = new Size(200, 20);
    this.m_robotNameTextBox.TabIndex = 8;
    this.m_robotNameTextBox.Text = "";
    this.m_includedObjectsTreeView.CheckBoxes = true;
    this.m_includedObjectsTreeView.ImageIndex = -1;
    this.m_includedObjectsTreeView.Location = new Point(8, 216);
    this.m_includedObjectsTreeView.Name = "m_includedObjectsTreeView";
    this.m_includedObjectsTreeView.Nodes.AddRange(new TreeNode[1]
    {
      new TreeNode("All")
    });
    this.m_includedObjectsTreeView.SelectedImageIndex = -1;
    this.m_includedObjectsTreeView.Size = new Size(272, 136);
    this.m_includedObjectsTreeView.TabIndex = 9;
    ((Control) this.m_progressBar).Location = new Point(8, 360);
    ((Control) this.m_progressBar).Name = "m_progressBar";
    ((Control) this.m_progressBar).Size = new Size(272, 24);
    ((Control) this.m_progressBar).TabIndex = 10;
    this.m_closeButton.DialogResult = DialogResult.Cancel;
    this.m_closeButton.Location = new Point(192 /*0xC0*/, 392);
    this.m_closeButton.Name = "m_closeButton";
    this.m_closeButton.Size = new Size(88, 24);
    this.m_closeButton.TabIndex = 11;
    this.m_closeButton.Text = "Close";
    this.m_closeButton.Click += new EventHandler(this.m_closeButton_Click);
    this.m_createButton.Location = new Point(96 /*0x60*/, 392);
    this.m_createButton.Name = "m_createButton";
    this.m_createButton.Size = new Size(88, 24);
    this.m_createButton.TabIndex = 11;
    this.m_createButton.Text = "Create";
    ((Form) this).AcceptButton = (IButtonControl) this.m_createButton;
    ((Form) this).AutoScaleBaseSize = new Size(5, 13);
    ((Form) this).CancelButton = (IButtonControl) this.m_closeButton;
    ((Form) this).ClientSize = new Size(288, 424);
    ((Control) this).Controls.Add((Control) this.m_closeButton);
    ((Control) this).Controls.Add((Control) this.m_progressBar);
    ((Control) this).Controls.Add((Control) this.m_includedObjectsTreeView);
    ((Control) this).Controls.Add((Control) this.m_robotNameTextBox);
    ((Control) this).Controls.Add((Control) this.m_fromLocation_txObjComboBoxCtrl);
    ((Control) this).Controls.Add((Control) this.m_operation_txObjEditBoxCtrl);
    ((Control) this).Controls.Add((Control) this.m_accuracyTrackBar);
    ((Control) this).Controls.Add((Control) this.m_operationLabel);
    ((Control) this).Controls.Add((Control) this.m_robotLabel);
    ((Control) this).Controls.Add((Control) this.m_volumeAccLabel);
    ((Control) this).Controls.Add((Control) this.m_maxErrorLabel);
    ((Control) this).Controls.Add((Control) this.m_accuracyValueLabel);
    ((Control) this).Controls.Add((Control) this.m_accuracyUnitsLabel);
    ((Control) this).Controls.Add((Control) this.m_fastLabel);
    ((Control) this).Controls.Add((Control) this.m_accurate_label);
    ((Control) this).Controls.Add((Control) this.m_toLocation_txObjComboBoxCtrl1);
    ((Control) this).Controls.Add((Control) this.m_FromLabel);
    ((Control) this).Controls.Add((Control) this.m_toLabel);
    ((Control) this).Controls.Add((Control) this.m_includedObjectsLabel);
    ((Control) this).Controls.Add((Control) this.m_createButton);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedDialog;
    ((Control) this).Name = nameof (CUiSvSweptVolumeDlg);
    ((Control) this).Text = "Swept Volume";
    this.m_accuracyTrackBar.EndInit();
    ((Control) this).ResumeLayout(false);
  }

  private bool isOperationValidForControl()
  {
    bool flag = false;
    if (this.m_operation_txObjEditBoxCtrl.Object != null)
      flag = true;
    if (flag)
      flag = this.m_operation_txObjEditBoxCtrl.Object is ITxRoboticOrderedCompoundOperation;
    return flag;
  }

  private bool isOperationValidForCreate()
  {
    return (this.m_operation_txObjEditBoxCtrl.Object as ITxRoboticOrderedCompoundOperation).Robot != null;
  }

  private void onOperationChanged()
  {
  }

  public void onSweptVolumeCreationEnded(object sender, EventArgs e)
  {
    if (!this.m_createOrStopMode)
      return;
    this.m_createOrStopMode = false;
    this.m_createButton.Text = StringTable.ResourceManager.GetString("SV_Create");
  }

  private void m_closeButton_Click(object sender, EventArgs e)
  {
    this.ResetSimulation();
    ((Form) this).Close();
    this.m_cmd.DialogIsOpen(false);
  }

  internal void ResetSimulation()
  {
    TxApplication.ActiveDocument.SimulationPlayer.ResetToDefaultSetting();
    TxApplication.ActiveDocument.SimulationPlayer.Rewind();
  }

  private void m_accuracyTrackBar_ValueChanged(object sender, EventArgs e)
  {
    this.m_accuracyValueLabel.Text = this.m_accuracyTrackBar.Value.ToString();
  }

  private void m_operation_txObjEditBoxCtrl_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.onOperationChanged();
  }

  private void m_operation_txObjEditBoxCtrl_TypeValid(object sender, EventArgs e)
  {
    this.onOperationChanged();
  }

  private void m_operation_txObjEditBoxCtrl_TypeInvalid(object sender, EventArgs e)
  {
  }
}
